package com.pxst.merchant.controller;

import com.pxst.merchant.entity.SysMerchantWhiteListEntity;
import com.pxst.merchant.req.WhiteListReq;
import com.pxst.merchant.resp.WhiteListResp;
import com.pxst.merchant.service.SysMerchantWhiteListService;
import com.pxst.resp.ApiResp;
import com.pxst.resp.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: @Ryan
 * @Description:
 * @CreateTime: 2023-09-15 09:35
 */
@RestController
@RequestMapping("/api/sh130")
@Api(tags = "商户白名单相关接口")
public class SysMerchantWhiteListController {
    @Autowired
    private SysMerchantWhiteListService sysMerchantWhiteListService;

    @GetMapping("/list")
    @ApiOperation("条件查询商户白名单列表")
    public ApiResp<PageResp<WhiteListResp>> getMerchantWhiteListByConditions(WhiteListReq whiteListReq){
        return sysMerchantWhiteListService.getWhiteListByConditions(whiteListReq);
    }


    @PostMapping("/add")
    @ApiOperation("将商户加入白名单")
    public ApiResp<SysMerchantWhiteListEntity> getMerchantWhiteListByConditions(@RequestBody SysMerchantWhiteListEntity entity){
        return sysMerchantWhiteListService.addWhiteListMember(entity);
    }

    @PutMapping("/update")
    @ApiOperation("跟新白名单记录信息")
    public ApiResp updateWhiteListMember(@RequestBody SysMerchantWhiteListEntity entity){
        return sysMerchantWhiteListService.updateWhiteListMember(entity);
    }
}
